#pragma once

#include <QWidget>
#include "util/serverhelper.h"
#include "util/usermanager.h"

namespace Ui {
class UserPage;
}

namespace WordMemory
{
    class UserPage : public QWidget
    {
        Q_OBJECT

    public:
        explicit UserPage(QWidget *parent = nullptr);
        ~UserPage();

        void refreshPageData();

    private slots:
        void on_updateButton_clicked();

        void onGetUserFinished(bool success, const User &user, const QString &error);
        void onUpdateUserFinished(bool success, const User &user, const QString &error);

    private:
        void setupConnections();
        void loadUserInfo();
        void applyStyles();

        Ui::UserPage *ui;
        ServerHelper* serverhelper;
    };
}
